<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.3.4/css/bootstrap.css" rel="stylesheet">
</head>
<body>
    <table class="table">
        <tr>
            <td>
                选择
            </td>
            <td>
                爱好
            </td>
        </tr>
        <tr>
            <td>
                <input type="checkbox" name="love" value="dushu">
            </td>
            <td>
                篮球：
            </td>
        </tr> 
        <tr>
            <td>
                <input type="checkbox" name="love" value="bianma">
            </td>
            <td>
                睡觉：
            </td>
        </tr>
        <tr>
            <td>
                <input type="checkbox" name="love" value="paobu">
            </td>
            <td>
                跑步：
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" class="btn btn-success" id="sltAll" value="全选">
                <input type="button" class="btn btn-success" id="sltRv" value="反选">
                <input type="button" class="btn btn-success" id="sltDel" value="取消">
            </td>
        </tr>

    </table>
    <script src="js/jquery.js"></script>
    <script>

        $('#sltAll').click(function(){
            var love = $('input[name="love"]');
            $.each(love, function(k,v){
                $(v).prop('checked', true);
            })
        })


        $('#sltDel').click(function(){
            var love = $('input[name="love"]');
            $.each(love, function(k,v){
                $(v).prop('checked', false);
            })
        })
    
        $('#sltRv').click(function(){
            var love = $('input[name="love"]');
            $.each(love, function(k,v){
                $(v).prop('checked', !$(v).prop('checked') );
            })
        })


    </script>

</body>
</html>